package com.tsystems.lection12.entities;

// Generated 25.11.2013 11:52:16 by Hibernate Tools 4.0.0

import static javax.persistence.GenerationType.IDENTITY;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Course generated by hbm2java
 */
@Entity
@Table(name = "COURSE", schema = "PUBLIC", catalog = "PUBLIC", uniqueConstraints = @UniqueConstraint(columnNames = "NAME"))
public class Course implements java.io.Serializable {

	private Integer id;
	private String name;
	private String description;
	private Set<TeacherCourse> teacherCourses = new HashSet<TeacherCourse>(0);

	public Course() {
	}

	public Course(String name) {
		this.name = name;
	}

	public Course(String name, String description,
			Set<TeacherCourse> teacherCourses) {
		this.name = name;
		this.description = description;
		this.teacherCourses = teacherCourses;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "NAME", unique = true, nullable = false, length = 128)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "DESCRIPTION", length = 2048)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "course")
	public Set<TeacherCourse> getTeacherCourses() {
		return this.teacherCourses;
	}

	public void setTeacherCourses(Set<TeacherCourse> teacherCourses) {
		this.teacherCourses = teacherCourses;
	}

}
